package com.huawei.controller;

import com.huawei.domain.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class TestController {

    @Autowired
    private Person person;

    //从配置文件中读取name属性并注入到name属性中
    @Value("${name}")
    private String name;

    @GetMapping("/test")
    public String test(){
        return person.toString()+name;
    }
}
